import fs from 'fs';

function Ab(filepath){
    let arr=[];
    let all=fs.readdirSync(filepath);
    all.forEach(item => {
        arr.push(item);
    });
    console.log(arr);
    arr.forEach((item)=>{
        let apath=item.indexOf()==="/";
        let spath=apath?filepath+item:`${filepath}/${item}`;
        let c=fs.statSync(spath);
        if(c.isDirectory()){
           let aarr= Ab(item);
           arr=arr.concat(aarr);
        }
    })
    return arr;
}

console.log(Ab('./'));